package s07;

import net.sf.cglib.beans.BeanGenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author wangpp
 */
public class BeanGeneratorTest {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        BeanGenerator generator = new BeanGenerator();
        generator.addProperty("value", String.class);
        Object o = generator.create();

        System.out.println(o);

        Method setValue = o.getClass().getMethod("setValue", String.class);
        setValue.invoke(o, "11111");

        Method getValue = o.getClass().getMethod("getValue");
        Object value = getValue.invoke(o);
        System.out.println(value);

    }
}
